<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : exportToODF.xsl
    Created on : Utorok, 2011, jún 14, 23:23
    Author     : Peter Mackay
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" version="1.0" encoding="utf-8"/>

    <xsl:template match="/">
        <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
                 xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
                 xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
                 xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
                 xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
                 xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
                 xmlns:xlink="http://www.w3.org/1999/xlink"
                 xmlns:dc="http://purl.org/dc/elements/1.1/"
                 xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
                 xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
                 xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
                 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
                 xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
                 xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
                 xmlns:math="http://www.w3.org/1998/Math/MathML"
                 xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
                 xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
                 xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
                 xmlns:ooo="http://openoffice.org/2004/office"
                 xmlns:ooow="http://openoffice.org/2004/writer"
                 xmlns:oooc="http://openoffice.org/2004/calc"
                 xmlns:dom="http://www.w3.org/2001/xml-events"
                 xmlns:xforms="http://www.w3.org/2002/xforms"
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:rpt="http://openoffice.org/2005/report"
                 xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2"
                 xmlns:xhtml="http://www.w3.org/1999/xhtml"
                 xmlns:grddl="http://www.w3.org/2003/g/data-view#"
                 xmlns:tableooo="http://openoffice.org/2009/table"
                 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"
                 xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
                 office:version="1.2"
                 grddl:transformation="http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl"
                 office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
            <office:meta>
                <meta:creation-date>2011-06-06T23:50:00</meta:creation-date>
                <meta:document-statistic meta:table-count="3" meta:cell-count="22" meta:object-count="0"/>
                <meta:generator>OpenOffice.org/3.2$Unix OpenOffice.org_project/320m12$Build-9483</meta:generator>
            </office:meta>






            <office:settings>
                <config:config-item-set config:name="ooo:view-settings">
                    <config:config-item config:name="VisibleAreaTop" config:type="int">0</config:config-item>
                    <config:config-item config:name="VisibleAreaLeft" config:type="int">0</config:config-item>
                    <config:config-item config:name="VisibleAreaWidth" config:type="int">15806</config:config-item>
                    <config:config-item config:name="VisibleAreaHeight" config:type="int">1349</config:config-item>
                    <config:config-item-map-indexed config:name="Views">
                        <config:config-item-map-entry>
                            <config:config-item config:name="ViewId" config:type="string">View1</config:config-item>
                            <config:config-item-map-named config:name="Tables">
                                <config:config-item-map-entry config:name="Sheet1">
                                    <config:config-item config:name="CursorPositionX" config:type="int">6</config:config-item>
                                    <config:config-item config:name="CursorPositionY" config:type="int">2</config:config-item>
                                    <config:config-item config:name="HorizontalSplitMode" config:type="short">0</config:config-item>
                                    <config:config-item config:name="VerticalSplitMode" config:type="short">0</config:config-item>
                                    <config:config-item config:name="HorizontalSplitPosition" config:type="int">0</config:config-item>
                                    <config:config-item config:name="VerticalSplitPosition" config:type="int">0</config:config-item>
                                    <config:config-item config:name="ActiveSplitRange" config:type="short">2</config:config-item>
                                    <config:config-item config:name="PositionLeft" config:type="int">0</config:config-item>
                                    <config:config-item config:name="PositionRight" config:type="int">0</config:config-item>
                                    <config:config-item config:name="PositionTop" config:type="int">0</config:config-item>
                                    <config:config-item config:name="PositionBottom" config:type="int">0</config:config-item>
                                    <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
                                    <config:config-item config:name="ZoomValue" config:type="int">100</config:config-item>
                                    <config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item>
                                    <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
                                </config:config-item-map-entry>
                                <config:config-item-map-entry config:name="Sheet2">
                                    <config:config-item config:name="CursorPositionX" config:type="int">0</config:config-item>
                                    <config:config-item config:name="CursorPositionY" config:type="int">2</config:config-item>
                                    <config:config-item config:name="HorizontalSplitMode" config:type="short">0</config:config-item>
                                    <config:config-item config:name="VerticalSplitMode" config:type="short">0</config:config-item>
                                    <config:config-item config:name="HorizontalSplitPosition" config:type="int">0</config:config-item>
                                    <config:config-item config:name="VerticalSplitPosition" config:type="int">0</config:config-item>
                                    <config:config-item config:name="ActiveSplitRange" config:type="short">2</config:config-item>
                                    <config:config-item config:name="PositionLeft" config:type="int">0</config:config-item>
                                    <config:config-item config:name="PositionRight" config:type="int">0</config:config-item>
                                    <config:config-item config:name="PositionTop" config:type="int">0</config:config-item>
                                    <config:config-item config:name="PositionBottom" config:type="int">0</config:config-item>
                                    <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
                                    <config:config-item config:name="ZoomValue" config:type="int">100</config:config-item>
                                    <config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item>
                                    <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
                                </config:config-item-map-entry>
                            </config:config-item-map-named>
                            <config:config-item config:name="ActiveTable" config:type="string">Sheet2</config:config-item>
                            <config:config-item config:name="HorizontalScrollbarWidth" config:type="int">270</config:config-item>
                            <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
                            <config:config-item config:name="ZoomValue" config:type="int">100</config:config-item>
                            <config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item>
                            <config:config-item config:name="ShowPageBreakPreview" config:type="boolean">false</config:config-item>
                            <config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item>
                            <config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item>
                            <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
                            <config:config-item config:name="GridColor" config:type="long">12632256</config:config-item>
                            <config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item>
                            <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item>
                            <config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item>
                            <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item>
                            <config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item>
                            <config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item>
                            <config:config-item config:name="RasterResolutionX" config:type="int">1000</config:config-item>
                            <config:config-item config:name="RasterResolutionY" config:type="int">1000</config:config-item>
                            <config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item>
                            <config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item>
                            <config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item>
                        </config:config-item-map-entry>
                    </config:config-item-map-indexed>
                </config:config-item-set>
                <config:config-item-set config:name="ooo:configuration-settings">
                    <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
                    <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
                    <config:config-item config:name="LinkUpdateMode" config:type="short">3</config:config-item>
                    <config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
                    <config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item>
                    <config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item>
                    <config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item>
                    <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
                    <config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item>
                    <config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item>
                    <config:config-item config:name="RasterResolutionX" config:type="int">1000</config:config-item>
                    <config:config-item config:name="RasterResolutionY" config:type="int">1000</config:config-item>
                    <config:config-item config:name="GridColor" config:type="long">12632256</config:config-item>
                    <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
                    <config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item>
                    <config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item>
                    <config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item>
                    <config:config-item config:name="PrinterName" config:type="string"/>
                    <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
                    <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
                    <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item>
                    <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item>
                    <config:config-item config:name="IsDocumentShared" config:type="boolean">false</config:config-item>
                    <config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item>
                    <config:config-item config:name="AutoCalculate" config:type="boolean">true</config:config-item>
                    <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
                    <config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item>
                </config:config-item-set>
            </office:settings>
            <office:scripts>
                <office:script script:language="ooo:Basic">
                    <ooo:libraries/>
                </office:script>
            </office:scripts>
            <office:font-face-decls>
                <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss"
                                   style:font-pitch="variable"/>
                <style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'"
                                   style:font-family-generic="system"
                                   style:font-pitch="variable"/>
            </office:font-face-decls>
            <office:styles>
                <style:default-style style:family="table-cell">
                    <style:table-cell-properties style:decimal-places="-1"/>
                    <style:paragraph-properties style:tab-stop-distance="1.25cm"/>
                    <style:text-properties style:font-name="Arial" fo:language="sk" fo:country="SK"
                                            style:font-name-asian="DejaVu Sans"
                                            style:language-asian="zh"
                                            style:country-asian="CN"
                                            style:font-name-complex="DejaVu Sans"
                                            style:language-complex="hi"
                                            style:country-complex="IN"/>
                </style:default-style>
                <number:number-style style:name="N0">
                    <number:number number:min-integer-digits="1"/>
                </number:number-style>
                <number:currency-style style:name="N106P0" style:volatile="true">
                    <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
                    <number:text> </number:text>
                    <number:currency-symbol number:language="sk" number:country="SK">€</number:currency-symbol>
                </number:currency-style>
                <number:currency-style style:name="N106">
                    <style:text-properties fo:color="#ff0000"/>
                    <number:text>-</number:text>
                    <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
                    <number:text> </number:text>
                    <number:currency-symbol number:language="sk" number:country="SK">€</number:currency-symbol>
                    <style:map style:condition="value()&gt;=0" style:apply-style-name="N106P0"/>
                </number:currency-style>
                <style:style style:name="Default" style:family="table-cell"/>
                <style:style style:name="Result" style:family="table-cell" style:parent-style-name="Default">
                    <style:text-properties fo:font-style="italic" style:text-underline-style="solid"
                                            style:text-underline-width="auto"
                                            style:text-underline-color="font-color"
                                            fo:font-weight="bold"/>
                </style:style>
                <style:style style:name="Result2" style:family="table-cell" style:parent-style-name="Result"
                               style:data-style-name="N106"/>
                <style:style style:name="Heading" style:family="table-cell"
                               style:parent-style-name="Default">
                    <style:table-cell-properties style:text-align-source="fix" style:repeat-content="false"/>
                    <style:paragraph-properties fo:text-align="center"/>
                    <style:text-properties fo:font-size="16pt" fo:font-style="italic" fo:font-weight="bold"/>
                </style:style>
                <style:style style:name="Heading1" style:family="table-cell"
                               style:parent-style-name="Heading">
                    <style:table-cell-properties style:rotation-angle="90"/>
                </style:style>
            </office:styles>
            <office:automatic-styles>
                <style:style style:name="co1" style:family="table-column">
                    <style:table-column-properties fo:break-before="auto" style:column-width="2.267cm"/>
                </style:style>
                <style:style style:name="ro1" style:family="table-row">
                    <style:table-row-properties style:row-height="0.452cm" fo:break-before="auto"
                                                 style:use-optimal-row-height="true"/>
                </style:style>
                <style:style style:name="ta1" style:family="table" style:master-page-name="Default">
                    <style:table-properties table:display="true" style:writing-mode="lr-tb"/>
                </style:style>
                <style:style style:name="ta_extref" style:family="table">
                    <style:table-properties table:display="false"/>
                </style:style>
                <style:page-layout style:name="pm1">
                    <style:page-layout-properties style:writing-mode="lr-tb"/>
                    <style:header-style>
                        <style:header-footer-properties fo:min-height="0.751cm" fo:margin-left="0cm" fo:margin-right="0cm"
                                                        fo:margin-bottom="0.25cm"/>
                    </style:header-style>
                    <style:footer-style>
                        <style:header-footer-properties fo:min-height="0.751cm" fo:margin-left="0cm" fo:margin-right="0cm"
                                                        fo:margin-top="0.25cm"/>
                    </style:footer-style>
                </style:page-layout>
                <style:page-layout style:name="pm2">
                    <style:page-layout-properties style:writing-mode="lr-tb"/>
                    <style:header-style>
                        <style:header-footer-properties fo:min-height="0.751cm" fo:margin-left="0cm" fo:margin-right="0cm"
                                                        fo:margin-bottom="0.25cm"
                                                        fo:border="0.088cm solid #000000"
                                                        fo:padding="0.018cm"
                                                        fo:background-color="#c0c0c0">
                            <style:background-image/>
                        </style:header-footer-properties>
                    </style:header-style>
                    <style:footer-style>
                        <style:header-footer-properties fo:min-height="0.751cm" fo:margin-left="0cm" fo:margin-right="0cm"
                                                        fo:margin-top="0.25cm"
                                                        fo:border="0.088cm solid #000000"
                                                        fo:padding="0.018cm"
                                                        fo:background-color="#c0c0c0">
                            <style:background-image/>
                        </style:header-footer-properties>
                    </style:footer-style>
                </style:page-layout>
            </office:automatic-styles>




            <office:master-styles>
                <style:master-page style:name="Default" style:page-layout-name="pm1">
                    <style:header>
                        <text:p>
                            <text:sheet-name>???</text:sheet-name>
                        </text:p>
                    </style:header>
                    <style:header-left style:display="false"/>
                    <style:footer>
                        <text:p>Page
                            <text:page-number>1</text:page-number>
                        </text:p>
                    </style:footer>
                    <style:footer-left style:display="false"/>
                </style:master-page>
                <style:master-page style:name="Report" style:page-layout-name="pm2">
                    <style:header>
                        <style:region-left>
                            <text:p>
                                <text:sheet-name>???</text:sheet-name> (
                                <text:title>???</text:title>)
                            </text:p>
                        </style:region-left>
                        <style:region-right>
                            <text:p>
                                <text:date style:data-style-name="N2" text:date-value="2011-06-07">07.06.2011</text:date>,
                                <text:time>01:46:50</text:time>
                            </text:p>
                        </style:region-right>
                    </style:header>
                    <style:header-left style:display="false"/>
                    <style:footer>
                        <text:p>Page
                            <text:page-number>1</text:page-number> /
                            <text:page-count>99</text:page-count>
                        </text:p>
                    </style:footer>
                    <style:footer-left style:display="false"/>
                </style:master-page>
            </office:master-styles>

            <office:body>
                <office:spreadsheet>
                    <table:table table:name="Movies" table:style-name="ta1" table:print="false">
                        <table:table-column table:style-name="co1" table:number-columns-repeated="7"
                                table:default-cell-style-name="Default"/>
                        <xsl:for-each select="//movie">
                            <table:table-row table:style-name="ro1">
                                <table:table-cell office:value-type="string">
                                    <text:p>
                                        <xsl:value-of select="name"/>
                                    </text:p>
                                </table:table-cell>
                                <table:table-cell office:value-type="string">
                                    <text:p>
                                        <xsl:value-of select="director"/>
                                    </text:p>
                                </table:table-cell>
                                <xsl:choose>
                                    <xsl:when test="year/text()">
                                        <xsl:element name="table:table-cell">
                                        <xsl:attribute name="office:value-type">float</xsl:attribute>
                                        <xsl:attribute name="office:value">
                                            <xsl:value-of select="year"/>
                                        </xsl:attribute>
                                        <text:p>
                                            <xsl:value-of select="year"/>
                                        </text:p>
                                    </xsl:element>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <table:table-cell table:number-columns-repeated="1"/>
                                    </xsl:otherwise>
                                </xsl:choose>
                                <table:table-cell office:value-type="string">
                                    <text:p>
                                        <xsl:value-of select="country"/>
                                    </text:p>
                                </table:table-cell>
                                <table:table-cell office:value-type="string">
                                    <text:p><xsl:for-each select="actors/actor"><xsl:value-of select="."/><xsl:if test="position()!=last()">, </xsl:if></xsl:for-each></text:p>
                                </table:table-cell>
                                <table:table-cell office:value-type="string">
                                    <text:p><xsl:for-each select="genres/genre"><xsl:value-of select="."/><xsl:if test="position()!=last()">, </xsl:if></xsl:for-each>
                                    </text:p>
                                </table:table-cell>
                                <xsl:element name="table:table-cell">
                                    <xsl:attribute name="office:value-type">float</xsl:attribute>
                                    <xsl:attribute name="office:value">
                                        <xsl:value-of select="../../@id"/>
                                    </xsl:attribute>
                                    <text:p>
                                        <xsl:value-of select="../../@id"/>
                                    </text:p>
                                </xsl:element>
                            </table:table-row >
                        </xsl:for-each>
                    </table:table>
                    <table:table table:name="DVDs" table:style-name="ta1" table:print="false">
                        <table:table-column table:style-name="co1" table:number-columns-repeated="3"
                                        table:default-cell-style-name="Default"/>
                        <xsl:for-each select="videodes/dvd">
                            <table:table-row table:style-name="ro1">
                                <xsl:element name="table:table-cell">
                                    <xsl:attribute name="office:value-type">float</xsl:attribute>
                                    <xsl:attribute name="office:value">
                                        <xsl:value-of select="@id"/>
                                    </xsl:attribute>
                                    <text:p>
                                        <xsl:value-of select="@id"/>
                                    </text:p>
                                </xsl:element>
                                <table:table-cell office:value-type="string">
                                    <text:p>
                                        <xsl:value-of select="title"/>
                                    </text:p>
                                </table:table-cell>
                                <table:table-cell office:value-type="string">
                                    <text:p>
                                        <xsl:value-of select="type"/>
                                    </text:p>
                                </table:table-cell>
                            </table:table-row>
                        </xsl:for-each>
                    </table:table>
                </office:spreadsheet>
            </office:body>
        </office:document>
    </xsl:template>

</xsl:stylesheet>
